﻿#region DaLevelDeclare
/*----------------------------------------------------------------
// 文件名：DaLevelDeclare.cs
// 功能描述：类LevelDeclare的数据访问层
//
// 
// 创建时间：2009-07-10 DtataAccess template . Ver 5.0.20090413
//
// 修改标识： 
// 修改描述： 
//----------------------------------------------------------------*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Globalization;
using System.Text;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;

using Las.Model; 


namespace Las.Dal
{
	///可以继承更上层接口,ILevelDeclare ,数据访问层基类DaBase，
	///DaBase中包含了DbException异常处理静态方法
    public	partial  class DaLevelDeclare:DaBase<MoLevelDeclare>
    {	 
		#region SQL const
		internal const string TABLE_COLUMNS=" LEV_DCL_ID ,YEAR_NUM ,ITEM_TYPE ,ITEM_ID ,ITEM_NAME ,CLASS1 ,CLASS2 ,CLASS3 ,CLASS4 ,CLASS5 ,CLASS6 ,CLASS7 ,CLASS8 ,CLASS9 ,CLASS10 ,CLASS11 ,CLASS12 ,FROM_YEAR ,FROM_LEVEL ,TO_LEVEL ,APPROVE_LEV ,SBDW_ID ,SBDW_NAME ,SLDW_ID ,SBR_ID ,SBR_NAME ,SLDW_NAME ,SBSJ ,LEV_DCL_STATUS ,SCR_ID ,SCR_NAME ,SCSJ ,ASS_GRP_ID ,ASS_GRP_NAME ,ASS_GRP_SCORE ,KCR_ID ,KCR_NAME ,KCSJ ,PDR_ID ,PDR_NAME ,PDSJ ,ZGSCQK ,ZGSBQK ,DJKCQK   ";
		
		internal const string SQL_INSERT="INSERT INTO LA_LEVEL_DECLARE ("+TABLE_COLUMNS+") VALUES (@LevDclId,@YearNum,@ItemType,@ItemId,@ItemName,@Class1,@Class2,@Class3,@Class4,@Class5,@Class6,@Class7,@Class8,@Class9,@Class10,@Class11,@Class12,@FromYear,@FromLevel,@ToLevel,@ApproveLev,@SbdwId,@SbdwName,@SldwId,@SbrId,@SbrName,@SldwName,@Sbsj,@LevDclStatus,@ScrId,@ScrName,@Scsj,@AssGrpId,@AssGrpName,@AssGrpScore,@KcrId,@KcrName,@Kcsj,@PdrId,@PdrName,@Pdsj,@Zgscqk,@Zgsbqk,@Djkcqk)";
		internal const string SQL_SELECT="SELECT "+TABLE_COLUMNS+" FROM LA_LEVEL_DECLARE  ";
		internal const string SQL_SELECT_ONE=SQL_SELECT+" WHERE LEV_DCL_ID=@LevDclId";                              
		
		internal const string SQL_EXIST="SELECT COUNT(*) FROM LA_LEVEL_DECLARE  WHERE LEV_DCL_ID=@LevDclId  ";
		internal const string SQL_UPDATE="UPDATE LA_LEVEL_DECLARE SET YEAR_NUM=@YearNum, ITEM_TYPE=@ItemType, ITEM_ID=@ItemId, ITEM_NAME=@ItemName, CLASS1=@Class1, CLASS2=@Class2, CLASS3=@Class3, CLASS4=@Class4, CLASS5=@Class5, CLASS6=@Class6, CLASS7=@Class7, CLASS8=@Class8, CLASS9=@Class9, CLASS10=@Class10, CLASS11=@Class11, CLASS12=@Class12, FROM_YEAR=@FromYear, FROM_LEVEL=@FromLevel, TO_LEVEL=@ToLevel, APPROVE_LEV=@ApproveLev, SBDW_ID=@SbdwId, SBDW_NAME=@SbdwName, SLDW_ID=@SldwId, SBR_ID=@SbrId, SBR_NAME=@SbrName, SLDW_NAME=@SldwName, SBSJ=@Sbsj, LEV_DCL_STATUS=@LevDclStatus, SCR_ID=@ScrId, SCR_NAME=@ScrName, SCSJ=@Scsj, ASS_GRP_ID=@AssGrpId, ASS_GRP_NAME=@AssGrpName, ASS_GRP_SCORE=@AssGrpScore, KCR_ID=@KcrId, KCR_NAME=@KcrName, KCSJ=@Kcsj, PDR_ID=@PdrId, PDR_NAME=@PdrName, PDSJ=@Pdsj, ZGSCQK=@Zgscqk, ZGSBQK=@Zgsbqk, DJKCQK=@Djkcqk WHERE LEV_DCL_ID=@LevDclId";
		
		internal const string SQL_DELETE_DEFAULT = "DELETE FROM LA_LEVEL_DECLARE ";
		internal const string SQL_DELETE="DELETE FROM LA_LEVEL_DECLARE WHERE LEV_DCL_ID=@LevDclId";
		
		internal const string SQL_COUNT="SELECT COUNT(*) FROM LA_LEVEL_DECLARE";
		#endregion
		       
		#region Constructor
	 
		/// <summary>
        /// 默认构造函数，使用配置文件中默认的数据库配置。
        /// </summary>
		public DaLevelDeclare ()
		{ 
			this.db=DatabaseFactory.CreateDatabase();
		}
		/// <summary>
        /// 使用指定的databaseName数据库配置。
        /// </summary>
        /// <param name="databaseName">配置文件中数据库的配置名称。</param>
		public DaLevelDeclare (string databaseName)
		{ 
            this.db = DatabaseFactory.CreateDatabase(databaseName);
		} 
		
		public DaLevelDeclare (Database db)
		{ 
            this.db = db;
		} 
		
		#endregion
		
		//以下是CRUD方法，每个方法都有引入外部事务的版本

		#region 构造器模块
		
        protected override MoLevelDeclare ConstructT()
        {
            return new MoLevelDeclare();
        }
        #endregion
		
	    
		
		#region Add模块 Helper
		
		///build the command object.It never throw exception.
		protected override  DbCommand ConstructAddCommand(Database db)
		{
			DbCommand dbCommand = db.GetSqlStringCommand(SQL_INSERT);
			 
			db.AddInParameter(dbCommand,"LevDclId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"YearNum",DbType.Int32);
			db.AddInParameter(dbCommand,"ItemType",DbType.Int32);
			db.AddInParameter(dbCommand,"ItemId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"ItemName",DbType.String);
			db.AddInParameter(dbCommand,"Class1",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class2",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class3",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class4",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class5",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class6",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class7",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class8",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class9",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class10",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class11",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class12",DbType.AnsiString);
			db.AddInParameter(dbCommand,"FromYear",DbType.Int32);
			db.AddInParameter(dbCommand,"FromLevel",DbType.Int32);
			db.AddInParameter(dbCommand,"ToLevel",DbType.Int32);
			db.AddInParameter(dbCommand,"ApproveLev",DbType.Int32);
			db.AddInParameter(dbCommand,"SbdwId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"SbdwName",DbType.String);
			db.AddInParameter(dbCommand,"SldwId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"SbrId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"SbrName",DbType.String);
			db.AddInParameter(dbCommand,"SldwName",DbType.String);
			db.AddInParameter(dbCommand,"Sbsj",DbType.DateTime);
			db.AddInParameter(dbCommand,"LevDclStatus",DbType.Int32);
			db.AddInParameter(dbCommand,"ScrId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"ScrName",DbType.String);
			db.AddInParameter(dbCommand,"Scsj",DbType.DateTime);
			db.AddInParameter(dbCommand,"AssGrpId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"AssGrpName",DbType.String);
			db.AddInParameter(dbCommand,"AssGrpScore",DbType.Int32);
			db.AddInParameter(dbCommand,"KcrId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"KcrName",DbType.String);
			db.AddInParameter(dbCommand,"Kcsj",DbType.DateTime);
			db.AddInParameter(dbCommand,"PdrId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"PdrName",DbType.String);
			db.AddInParameter(dbCommand,"Pdsj",DbType.DateTime);
			db.AddInParameter(dbCommand,"Zgscqk",DbType.String);
			db.AddInParameter(dbCommand,"Zgsbqk",DbType.String);
			db.AddInParameter(dbCommand,"Djkcqk",DbType.String);
			return dbCommand;
		}		
		protected override DbCommand ConstructAddCommand(Database db,MoLevelDeclare entity)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_INSERT);			 
			db.AddInParameter(dbCommand,"LevDclId",DbType.AnsiString,entity.LevDclId);
			db.AddInParameter(dbCommand,"YearNum",DbType.Int32,entity.YearNum);
			db.AddInParameter(dbCommand,"ItemType",DbType.Int32,entity.ItemType);
			db.AddInParameter(dbCommand,"ItemId",DbType.AnsiString,entity.ItemId);
			db.AddInParameter(dbCommand,"ItemName",DbType.String,entity.ItemName);
			db.AddInParameter(dbCommand,"Class1",DbType.AnsiString,entity.Class1);
			db.AddInParameter(dbCommand,"Class2",DbType.AnsiString,entity.Class2);
			db.AddInParameter(dbCommand,"Class3",DbType.AnsiString,entity.Class3);
			db.AddInParameter(dbCommand,"Class4",DbType.AnsiString,entity.Class4);
			db.AddInParameter(dbCommand,"Class5",DbType.AnsiString,entity.Class5);
			db.AddInParameter(dbCommand,"Class6",DbType.AnsiString,entity.Class6);
			db.AddInParameter(dbCommand,"Class7",DbType.AnsiString,entity.Class7);
			db.AddInParameter(dbCommand,"Class8",DbType.AnsiString,entity.Class8);
			db.AddInParameter(dbCommand,"Class9",DbType.AnsiString,entity.Class9);
			db.AddInParameter(dbCommand,"Class10",DbType.AnsiString,entity.Class10);
			db.AddInParameter(dbCommand,"Class11",DbType.AnsiString,entity.Class11);
			db.AddInParameter(dbCommand,"Class12",DbType.AnsiString,entity.Class12);
			db.AddInParameter(dbCommand,"FromYear",DbType.Int32,entity.FromYear);
			db.AddInParameter(dbCommand,"FromLevel",DbType.Int32,entity.FromLevel);
			db.AddInParameter(dbCommand,"ToLevel",DbType.Int32,entity.ToLevel);
			db.AddInParameter(dbCommand,"ApproveLev",DbType.Int32,entity.ApproveLev);
			db.AddInParameter(dbCommand,"SbdwId",DbType.AnsiString,entity.SbdwId);
			db.AddInParameter(dbCommand,"SbdwName",DbType.String,entity.SbdwName);
			db.AddInParameter(dbCommand,"SldwId",DbType.AnsiString,entity.SldwId);
			db.AddInParameter(dbCommand,"SbrId",DbType.AnsiString,entity.SbrId);
			db.AddInParameter(dbCommand,"SbrName",DbType.String,entity.SbrName);
			db.AddInParameter(dbCommand,"SldwName",DbType.String,entity.SldwName);
			db.AddInParameter(dbCommand,"Sbsj",DbType.DateTime,entity.Sbsj);
			db.AddInParameter(dbCommand,"LevDclStatus",DbType.Int32,entity.LevDclStatus);
			db.AddInParameter(dbCommand,"ScrId",DbType.AnsiString,entity.ScrId);
			db.AddInParameter(dbCommand,"ScrName",DbType.String,entity.ScrName);
			db.AddInParameter(dbCommand,"Scsj",DbType.DateTime,entity.Scsj);
			db.AddInParameter(dbCommand,"AssGrpId",DbType.AnsiString,entity.AssGrpId);
			db.AddInParameter(dbCommand,"AssGrpName",DbType.String,entity.AssGrpName);
			db.AddInParameter(dbCommand,"AssGrpScore",DbType.Int32,entity.AssGrpScore);
			db.AddInParameter(dbCommand,"KcrId",DbType.AnsiString,entity.KcrId);
			db.AddInParameter(dbCommand,"KcrName",DbType.String,entity.KcrName);
			db.AddInParameter(dbCommand,"Kcsj",DbType.DateTime,entity.Kcsj);
			db.AddInParameter(dbCommand,"PdrId",DbType.AnsiString,entity.PdrId);
			db.AddInParameter(dbCommand,"PdrName",DbType.String,entity.PdrName);
			db.AddInParameter(dbCommand,"Pdsj",DbType.DateTime,entity.Pdsj);
			db.AddInParameter(dbCommand,"Zgscqk",DbType.String,entity.Zgscqk);
			db.AddInParameter(dbCommand,"Zgsbqk",DbType.String,entity.Zgsbqk);
			db.AddInParameter(dbCommand,"Djkcqk",DbType.String,entity.Djkcqk);
			return dbCommand;
		}
		
		protected override DbCommand PopulateAddCommandParameters(Database db,DbCommand addCmd,MoLevelDeclare entity)
		{
			db.SetParameterValue(addCmd,"LevDclId",entity.LevDclId);
			db.SetParameterValue(addCmd,"YearNum",entity.YearNum);
			db.SetParameterValue(addCmd,"ItemType",entity.ItemType);
			db.SetParameterValue(addCmd,"ItemId",entity.ItemId);
			db.SetParameterValue(addCmd,"ItemName",entity.ItemName);
			db.SetParameterValue(addCmd,"Class1",entity.Class1);
			db.SetParameterValue(addCmd,"Class2",entity.Class2);
			db.SetParameterValue(addCmd,"Class3",entity.Class3);
			db.SetParameterValue(addCmd,"Class4",entity.Class4);
			db.SetParameterValue(addCmd,"Class5",entity.Class5);
			db.SetParameterValue(addCmd,"Class6",entity.Class6);
			db.SetParameterValue(addCmd,"Class7",entity.Class7);
			db.SetParameterValue(addCmd,"Class8",entity.Class8);
			db.SetParameterValue(addCmd,"Class9",entity.Class9);
			db.SetParameterValue(addCmd,"Class10",entity.Class10);
			db.SetParameterValue(addCmd,"Class11",entity.Class11);
			db.SetParameterValue(addCmd,"Class12",entity.Class12);
			db.SetParameterValue(addCmd,"FromYear",entity.FromYear);
			db.SetParameterValue(addCmd,"FromLevel",entity.FromLevel);
			db.SetParameterValue(addCmd,"ToLevel",entity.ToLevel);
			db.SetParameterValue(addCmd,"ApproveLev",entity.ApproveLev);
			db.SetParameterValue(addCmd,"SbdwId",entity.SbdwId);
			db.SetParameterValue(addCmd,"SbdwName",entity.SbdwName);
			db.SetParameterValue(addCmd,"SldwId",entity.SldwId);
			db.SetParameterValue(addCmd,"SbrId",entity.SbrId);
			db.SetParameterValue(addCmd,"SbrName",entity.SbrName);
			db.SetParameterValue(addCmd,"SldwName",entity.SldwName);
			db.SetParameterValue(addCmd,"Sbsj",entity.Sbsj);
			db.SetParameterValue(addCmd,"LevDclStatus",entity.LevDclStatus);
			db.SetParameterValue(addCmd,"ScrId",entity.ScrId);
			db.SetParameterValue(addCmd,"ScrName",entity.ScrName);
			db.SetParameterValue(addCmd,"Scsj",entity.Scsj);
			db.SetParameterValue(addCmd,"AssGrpId",entity.AssGrpId);
			db.SetParameterValue(addCmd,"AssGrpName",entity.AssGrpName);
			db.SetParameterValue(addCmd,"AssGrpScore",entity.AssGrpScore);
			db.SetParameterValue(addCmd,"KcrId",entity.KcrId);
			db.SetParameterValue(addCmd,"KcrName",entity.KcrName);
			db.SetParameterValue(addCmd,"Kcsj",entity.Kcsj);
			db.SetParameterValue(addCmd,"PdrId",entity.PdrId);
			db.SetParameterValue(addCmd,"PdrName",entity.PdrName);
			db.SetParameterValue(addCmd,"Pdsj",entity.Pdsj);
			db.SetParameterValue(addCmd,"Zgscqk",entity.Zgscqk);
			db.SetParameterValue(addCmd,"Zgsbqk",entity.Zgsbqk);
			db.SetParameterValue(addCmd,"Djkcqk",entity.Djkcqk);
			return addCmd;
		}
		
		protected override DbCommand PopulateAddCommandParameters(Database db,DbCommand addCmd,DataRow row)
		{
			db.SetParameterValue(addCmd,"LevDclId",row["LevDclId"]);
			db.SetParameterValue(addCmd,"YearNum",row["YearNum"]);
			db.SetParameterValue(addCmd,"ItemType",row["ItemType"]);
			db.SetParameterValue(addCmd,"ItemId",row["ItemId"]);
			db.SetParameterValue(addCmd,"ItemName",row["ItemName"]);
			db.SetParameterValue(addCmd,"Class1",row["Class1"]);
			db.SetParameterValue(addCmd,"Class2",row["Class2"]);
			db.SetParameterValue(addCmd,"Class3",row["Class3"]);
			db.SetParameterValue(addCmd,"Class4",row["Class4"]);
			db.SetParameterValue(addCmd,"Class5",row["Class5"]);
			db.SetParameterValue(addCmd,"Class6",row["Class6"]);
			db.SetParameterValue(addCmd,"Class7",row["Class7"]);
			db.SetParameterValue(addCmd,"Class8",row["Class8"]);
			db.SetParameterValue(addCmd,"Class9",row["Class9"]);
			db.SetParameterValue(addCmd,"Class10",row["Class10"]);
			db.SetParameterValue(addCmd,"Class11",row["Class11"]);
			db.SetParameterValue(addCmd,"Class12",row["Class12"]);
			db.SetParameterValue(addCmd,"FromYear",row["FromYear"]);
			db.SetParameterValue(addCmd,"FromLevel",row["FromLevel"]);
			db.SetParameterValue(addCmd,"ToLevel",row["ToLevel"]);
			db.SetParameterValue(addCmd,"ApproveLev",row["ApproveLev"]);
			db.SetParameterValue(addCmd,"SbdwId",row["SbdwId"]);
			db.SetParameterValue(addCmd,"SbdwName",row["SbdwName"]);
			db.SetParameterValue(addCmd,"SldwId",row["SldwId"]);
			db.SetParameterValue(addCmd,"SbrId",row["SbrId"]);
			db.SetParameterValue(addCmd,"SbrName",row["SbrName"]);
			db.SetParameterValue(addCmd,"SldwName",row["SldwName"]);
			db.SetParameterValue(addCmd,"Sbsj",row["Sbsj"]);
			db.SetParameterValue(addCmd,"LevDclStatus",row["LevDclStatus"]);
			db.SetParameterValue(addCmd,"ScrId",row["ScrId"]);
			db.SetParameterValue(addCmd,"ScrName",row["ScrName"]);
			db.SetParameterValue(addCmd,"Scsj",row["Scsj"]);
			db.SetParameterValue(addCmd,"AssGrpId",row["AssGrpId"]);
			db.SetParameterValue(addCmd,"AssGrpName",row["AssGrpName"]);
			db.SetParameterValue(addCmd,"AssGrpScore",row["AssGrpScore"]);
			db.SetParameterValue(addCmd,"KcrId",row["KcrId"]);
			db.SetParameterValue(addCmd,"KcrName",row["KcrName"]);
			db.SetParameterValue(addCmd,"Kcsj",row["Kcsj"]);
			db.SetParameterValue(addCmd,"PdrId",row["PdrId"]);
			db.SetParameterValue(addCmd,"PdrName",row["PdrName"]);
			db.SetParameterValue(addCmd,"Pdsj",row["Pdsj"]);
			db.SetParameterValue(addCmd,"Zgscqk",row["Zgscqk"]);
			db.SetParameterValue(addCmd,"Zgsbqk",row["Zgsbqk"]);
			db.SetParameterValue(addCmd,"Djkcqk",row["Djkcqk"]);
			return addCmd;
		}
		
		#endregion
		    
		#region Update模块 Helper
		
		protected override DbCommand ConstructUpdateCommand(Database db)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_UPDATE);		    
			db.AddInParameter(dbCommand,"YearNum",DbType.Int32);
			db.AddInParameter(dbCommand,"ItemType",DbType.Int32);
			db.AddInParameter(dbCommand,"ItemId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"ItemName",DbType.String);
			db.AddInParameter(dbCommand,"Class1",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class2",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class3",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class4",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class5",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class6",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class7",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class8",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class9",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class10",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class11",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class12",DbType.AnsiString);
			db.AddInParameter(dbCommand,"FromYear",DbType.Int32);
			db.AddInParameter(dbCommand,"FromLevel",DbType.Int32);
			db.AddInParameter(dbCommand,"ToLevel",DbType.Int32);
			db.AddInParameter(dbCommand,"ApproveLev",DbType.Int32);
			db.AddInParameter(dbCommand,"SbdwId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"SbdwName",DbType.String);
			db.AddInParameter(dbCommand,"SldwId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"SbrId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"SbrName",DbType.String);
			db.AddInParameter(dbCommand,"SldwName",DbType.String);
			db.AddInParameter(dbCommand,"Sbsj",DbType.DateTime);
			db.AddInParameter(dbCommand,"LevDclStatus",DbType.Int32);
			db.AddInParameter(dbCommand,"ScrId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"ScrName",DbType.String);
			db.AddInParameter(dbCommand,"Scsj",DbType.DateTime);
			db.AddInParameter(dbCommand,"AssGrpId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"AssGrpName",DbType.String);
			db.AddInParameter(dbCommand,"AssGrpScore",DbType.Int32);
			db.AddInParameter(dbCommand,"KcrId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"KcrName",DbType.String);
			db.AddInParameter(dbCommand,"Kcsj",DbType.DateTime);
			db.AddInParameter(dbCommand,"PdrId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"PdrName",DbType.String);
			db.AddInParameter(dbCommand,"Pdsj",DbType.DateTime);
			db.AddInParameter(dbCommand,"Zgscqk",DbType.String);
			db.AddInParameter(dbCommand,"Zgsbqk",DbType.String);
			db.AddInParameter(dbCommand,"Djkcqk",DbType.String);
			db.AddInParameter(dbCommand,"LevDclId",DbType.AnsiString);
			 
			return dbCommand;
		}
		protected override DbCommand ConstructUpdateCommand(Database db,MoLevelDeclare entity)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_UPDATE);		    
			db.AddInParameter(dbCommand,"YearNum",DbType.Int32,entity.YearNum);
			db.AddInParameter(dbCommand,"ItemType",DbType.Int32,entity.ItemType);
			db.AddInParameter(dbCommand,"ItemId",DbType.AnsiString,entity.ItemId);
			db.AddInParameter(dbCommand,"ItemName",DbType.String,entity.ItemName);
			db.AddInParameter(dbCommand,"Class1",DbType.AnsiString,entity.Class1);
			db.AddInParameter(dbCommand,"Class2",DbType.AnsiString,entity.Class2);
			db.AddInParameter(dbCommand,"Class3",DbType.AnsiString,entity.Class3);
			db.AddInParameter(dbCommand,"Class4",DbType.AnsiString,entity.Class4);
			db.AddInParameter(dbCommand,"Class5",DbType.AnsiString,entity.Class5);
			db.AddInParameter(dbCommand,"Class6",DbType.AnsiString,entity.Class6);
			db.AddInParameter(dbCommand,"Class7",DbType.AnsiString,entity.Class7);
			db.AddInParameter(dbCommand,"Class8",DbType.AnsiString,entity.Class8);
			db.AddInParameter(dbCommand,"Class9",DbType.AnsiString,entity.Class9);
			db.AddInParameter(dbCommand,"Class10",DbType.AnsiString,entity.Class10);
			db.AddInParameter(dbCommand,"Class11",DbType.AnsiString,entity.Class11);
			db.AddInParameter(dbCommand,"Class12",DbType.AnsiString,entity.Class12);
			db.AddInParameter(dbCommand,"FromYear",DbType.Int32,entity.FromYear);
			db.AddInParameter(dbCommand,"FromLevel",DbType.Int32,entity.FromLevel);
			db.AddInParameter(dbCommand,"ToLevel",DbType.Int32,entity.ToLevel);
			db.AddInParameter(dbCommand,"ApproveLev",DbType.Int32,entity.ApproveLev);
			db.AddInParameter(dbCommand,"SbdwId",DbType.AnsiString,entity.SbdwId);
			db.AddInParameter(dbCommand,"SbdwName",DbType.String,entity.SbdwName);
			db.AddInParameter(dbCommand,"SldwId",DbType.AnsiString,entity.SldwId);
			db.AddInParameter(dbCommand,"SbrId",DbType.AnsiString,entity.SbrId);
			db.AddInParameter(dbCommand,"SbrName",DbType.String,entity.SbrName);
			db.AddInParameter(dbCommand,"SldwName",DbType.String,entity.SldwName);
			db.AddInParameter(dbCommand,"Sbsj",DbType.DateTime,entity.Sbsj);
			db.AddInParameter(dbCommand,"LevDclStatus",DbType.Int32,entity.LevDclStatus);
			db.AddInParameter(dbCommand,"ScrId",DbType.AnsiString,entity.ScrId);
			db.AddInParameter(dbCommand,"ScrName",DbType.String,entity.ScrName);
			db.AddInParameter(dbCommand,"Scsj",DbType.DateTime,entity.Scsj);
			db.AddInParameter(dbCommand,"AssGrpId",DbType.AnsiString,entity.AssGrpId);
			db.AddInParameter(dbCommand,"AssGrpName",DbType.String,entity.AssGrpName);
			db.AddInParameter(dbCommand,"AssGrpScore",DbType.Int32,entity.AssGrpScore);
			db.AddInParameter(dbCommand,"KcrId",DbType.AnsiString,entity.KcrId);
			db.AddInParameter(dbCommand,"KcrName",DbType.String,entity.KcrName);
			db.AddInParameter(dbCommand,"Kcsj",DbType.DateTime,entity.Kcsj);
			db.AddInParameter(dbCommand,"PdrId",DbType.AnsiString,entity.PdrId);
			db.AddInParameter(dbCommand,"PdrName",DbType.String,entity.PdrName);
			db.AddInParameter(dbCommand,"Pdsj",DbType.DateTime,entity.Pdsj);
			db.AddInParameter(dbCommand,"Zgscqk",DbType.String,entity.Zgscqk);
			db.AddInParameter(dbCommand,"Zgsbqk",DbType.String,entity.Zgsbqk);
			db.AddInParameter(dbCommand,"Djkcqk",DbType.String,entity.Djkcqk);
			db.AddInParameter(dbCommand,"LevDclId",DbType.AnsiString,entity.LevDclId);
			 
			return dbCommand;
		}
		
		protected override DbCommand PopulateUpdateCommandParameters(Database db,DbCommand updateCmd,MoLevelDeclare entity)
		{
			db.SetParameterValue(updateCmd,"YearNum",entity.YearNum);
			db.SetParameterValue(updateCmd,"ItemType",entity.ItemType);
			db.SetParameterValue(updateCmd,"ItemId",entity.ItemId);
			db.SetParameterValue(updateCmd,"ItemName",entity.ItemName);
			db.SetParameterValue(updateCmd,"Class1",entity.Class1);
			db.SetParameterValue(updateCmd,"Class2",entity.Class2);
			db.SetParameterValue(updateCmd,"Class3",entity.Class3);
			db.SetParameterValue(updateCmd,"Class4",entity.Class4);
			db.SetParameterValue(updateCmd,"Class5",entity.Class5);
			db.SetParameterValue(updateCmd,"Class6",entity.Class6);
			db.SetParameterValue(updateCmd,"Class7",entity.Class7);
			db.SetParameterValue(updateCmd,"Class8",entity.Class8);
			db.SetParameterValue(updateCmd,"Class9",entity.Class9);
			db.SetParameterValue(updateCmd,"Class10",entity.Class10);
			db.SetParameterValue(updateCmd,"Class11",entity.Class11);
			db.SetParameterValue(updateCmd,"Class12",entity.Class12);
			db.SetParameterValue(updateCmd,"FromYear",entity.FromYear);
			db.SetParameterValue(updateCmd,"FromLevel",entity.FromLevel);
			db.SetParameterValue(updateCmd,"ToLevel",entity.ToLevel);
			db.SetParameterValue(updateCmd,"ApproveLev",entity.ApproveLev);
			db.SetParameterValue(updateCmd,"SbdwId",entity.SbdwId);
			db.SetParameterValue(updateCmd,"SbdwName",entity.SbdwName);
			db.SetParameterValue(updateCmd,"SldwId",entity.SldwId);
			db.SetParameterValue(updateCmd,"SbrId",entity.SbrId);
			db.SetParameterValue(updateCmd,"SbrName",entity.SbrName);
			db.SetParameterValue(updateCmd,"SldwName",entity.SldwName);
			db.SetParameterValue(updateCmd,"Sbsj",entity.Sbsj);
			db.SetParameterValue(updateCmd,"LevDclStatus",entity.LevDclStatus);
			db.SetParameterValue(updateCmd,"ScrId",entity.ScrId);
			db.SetParameterValue(updateCmd,"ScrName",entity.ScrName);
			db.SetParameterValue(updateCmd,"Scsj",entity.Scsj);
			db.SetParameterValue(updateCmd,"AssGrpId",entity.AssGrpId);
			db.SetParameterValue(updateCmd,"AssGrpName",entity.AssGrpName);
			db.SetParameterValue(updateCmd,"AssGrpScore",entity.AssGrpScore);
			db.SetParameterValue(updateCmd,"KcrId",entity.KcrId);
			db.SetParameterValue(updateCmd,"KcrName",entity.KcrName);
			db.SetParameterValue(updateCmd,"Kcsj",entity.Kcsj);
			db.SetParameterValue(updateCmd,"PdrId",entity.PdrId);
			db.SetParameterValue(updateCmd,"PdrName",entity.PdrName);
			db.SetParameterValue(updateCmd,"Pdsj",entity.Pdsj);
			db.SetParameterValue(updateCmd,"Zgscqk",entity.Zgscqk);
			db.SetParameterValue(updateCmd,"Zgsbqk",entity.Zgsbqk);
			db.SetParameterValue(updateCmd,"Djkcqk",entity.Djkcqk);
			db.SetParameterValue(updateCmd,"LevDclId",entity.LevDclId);
			return updateCmd;
		}
		protected override DbCommand PopulateUpdateCommandParameters(Database db,DbCommand updateCmd,DataRow row)
		{
			db.SetParameterValue(updateCmd,"YearNum",row["YearNum"]);
			db.SetParameterValue(updateCmd,"ItemType",row["ItemType"]);
			db.SetParameterValue(updateCmd,"ItemId",row["ItemId"]);
			db.SetParameterValue(updateCmd,"ItemName",row["ItemName"]);
			db.SetParameterValue(updateCmd,"Class1",row["Class1"]);
			db.SetParameterValue(updateCmd,"Class2",row["Class2"]);
			db.SetParameterValue(updateCmd,"Class3",row["Class3"]);
			db.SetParameterValue(updateCmd,"Class4",row["Class4"]);
			db.SetParameterValue(updateCmd,"Class5",row["Class5"]);
			db.SetParameterValue(updateCmd,"Class6",row["Class6"]);
			db.SetParameterValue(updateCmd,"Class7",row["Class7"]);
			db.SetParameterValue(updateCmd,"Class8",row["Class8"]);
			db.SetParameterValue(updateCmd,"Class9",row["Class9"]);
			db.SetParameterValue(updateCmd,"Class10",row["Class10"]);
			db.SetParameterValue(updateCmd,"Class11",row["Class11"]);
			db.SetParameterValue(updateCmd,"Class12",row["Class12"]);
			db.SetParameterValue(updateCmd,"FromYear",row["FromYear"]);
			db.SetParameterValue(updateCmd,"FromLevel",row["FromLevel"]);
			db.SetParameterValue(updateCmd,"ToLevel",row["ToLevel"]);
			db.SetParameterValue(updateCmd,"ApproveLev",row["ApproveLev"]);
			db.SetParameterValue(updateCmd,"SbdwId",row["SbdwId"]);
			db.SetParameterValue(updateCmd,"SbdwName",row["SbdwName"]);
			db.SetParameterValue(updateCmd,"SldwId",row["SldwId"]);
			db.SetParameterValue(updateCmd,"SbrId",row["SbrId"]);
			db.SetParameterValue(updateCmd,"SbrName",row["SbrName"]);
			db.SetParameterValue(updateCmd,"SldwName",row["SldwName"]);
			db.SetParameterValue(updateCmd,"Sbsj",row["Sbsj"]);
			db.SetParameterValue(updateCmd,"LevDclStatus",row["LevDclStatus"]);
			db.SetParameterValue(updateCmd,"ScrId",row["ScrId"]);
			db.SetParameterValue(updateCmd,"ScrName",row["ScrName"]);
			db.SetParameterValue(updateCmd,"Scsj",row["Scsj"]);
			db.SetParameterValue(updateCmd,"AssGrpId",row["AssGrpId"]);
			db.SetParameterValue(updateCmd,"AssGrpName",row["AssGrpName"]);
			db.SetParameterValue(updateCmd,"AssGrpScore",row["AssGrpScore"]);
			db.SetParameterValue(updateCmd,"KcrId",row["KcrId"]);
			db.SetParameterValue(updateCmd,"KcrName",row["KcrName"]);
			db.SetParameterValue(updateCmd,"Kcsj",row["Kcsj"]);
			db.SetParameterValue(updateCmd,"PdrId",row["PdrId"]);
			db.SetParameterValue(updateCmd,"PdrName",row["PdrName"]);
			db.SetParameterValue(updateCmd,"Pdsj",row["Pdsj"]);
			db.SetParameterValue(updateCmd,"Zgscqk",row["Zgscqk"]);
			db.SetParameterValue(updateCmd,"Zgsbqk",row["Zgsbqk"]);
			db.SetParameterValue(updateCmd,"Djkcqk",row["Djkcqk"]);
			db.SetParameterValue(updateCmd,"LevDclId",row["LevDclId"]);
			return updateCmd;
		}
		
		protected override void PrepareDataAdapterCommand(Database db,out DbCommand dbInsertCommand,
		                     out DbCommand dbUpdateCommand,out DbCommand dbDeleteCommand)
		{
			dbInsertCommand = db.GetSqlStringCommand(SQL_INSERT);
			#region set insert cmd parameters
			db.AddInParameter(dbInsertCommand, "LevDclId",DbType.AnsiString, "LEV_DCL_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "YearNum",DbType.Int32, "YEAR_NUM", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "ItemType",DbType.Int32, "ITEM_TYPE", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "ItemId",DbType.AnsiString, "ITEM_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "ItemName",DbType.String, "ITEM_NAME", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Class1",DbType.AnsiString, "CLASS1", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Class2",DbType.AnsiString, "CLASS2", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Class3",DbType.AnsiString, "CLASS3", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Class4",DbType.AnsiString, "CLASS4", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Class5",DbType.AnsiString, "CLASS5", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Class6",DbType.AnsiString, "CLASS6", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Class7",DbType.AnsiString, "CLASS7", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Class8",DbType.AnsiString, "CLASS8", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Class9",DbType.AnsiString, "CLASS9", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Class10",DbType.AnsiString, "CLASS10", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Class11",DbType.AnsiString, "CLASS11", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Class12",DbType.AnsiString, "CLASS12", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "FromYear",DbType.Int32, "FROM_YEAR", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "FromLevel",DbType.Int32, "FROM_LEVEL", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "ToLevel",DbType.Int32, "TO_LEVEL", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "ApproveLev",DbType.Int32, "APPROVE_LEV", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "SbdwId",DbType.AnsiString, "SBDW_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "SbdwName",DbType.String, "SBDW_NAME", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "SldwId",DbType.AnsiString, "SLDW_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "SbrId",DbType.AnsiString, "SBR_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "SbrName",DbType.String, "SBR_NAME", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "SldwName",DbType.String, "SLDW_NAME", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Sbsj",DbType.DateTime, "SBSJ", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "LevDclStatus",DbType.Int32, "LEV_DCL_STATUS", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "ScrId",DbType.AnsiString, "SCR_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "ScrName",DbType.String, "SCR_NAME", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Scsj",DbType.DateTime, "SCSJ", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "AssGrpId",DbType.AnsiString, "ASS_GRP_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "AssGrpName",DbType.String, "ASS_GRP_NAME", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "AssGrpScore",DbType.Int32, "ASS_GRP_SCORE", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "KcrId",DbType.AnsiString, "KCR_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "KcrName",DbType.String, "KCR_NAME", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Kcsj",DbType.DateTime, "KCSJ", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "PdrId",DbType.AnsiString, "PDR_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "PdrName",DbType.String, "PDR_NAME", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Pdsj",DbType.DateTime, "PDSJ", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Zgscqk",DbType.String, "ZGSCQK", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Zgsbqk",DbType.String, "ZGSBQK", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Djkcqk",DbType.String, "DJKCQK", DataRowVersion.Current);
			#endregion
			dbUpdateCommand = db.GetSqlStringCommand(SQL_UPDATE);
			#region Set update cmd value parameters
			db.AddInParameter(dbUpdateCommand, "YearNum", DbType.Int32, "YEAR_NUM", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "ItemType", DbType.Int32, "ITEM_TYPE", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "ItemId", DbType.AnsiString, "ITEM_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "ItemName", DbType.String, "ITEM_NAME", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Class1", DbType.AnsiString, "CLASS1", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Class2", DbType.AnsiString, "CLASS2", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Class3", DbType.AnsiString, "CLASS3", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Class4", DbType.AnsiString, "CLASS4", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Class5", DbType.AnsiString, "CLASS5", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Class6", DbType.AnsiString, "CLASS6", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Class7", DbType.AnsiString, "CLASS7", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Class8", DbType.AnsiString, "CLASS8", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Class9", DbType.AnsiString, "CLASS9", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Class10", DbType.AnsiString, "CLASS10", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Class11", DbType.AnsiString, "CLASS11", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Class12", DbType.AnsiString, "CLASS12", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "FromYear", DbType.Int32, "FROM_YEAR", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "FromLevel", DbType.Int32, "FROM_LEVEL", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "ToLevel", DbType.Int32, "TO_LEVEL", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "ApproveLev", DbType.Int32, "APPROVE_LEV", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "SbdwId", DbType.AnsiString, "SBDW_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "SbdwName", DbType.String, "SBDW_NAME", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "SldwId", DbType.AnsiString, "SLDW_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "SbrId", DbType.AnsiString, "SBR_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "SbrName", DbType.String, "SBR_NAME", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "SldwName", DbType.String, "SLDW_NAME", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Sbsj", DbType.DateTime, "SBSJ", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "LevDclStatus", DbType.Int32, "LEV_DCL_STATUS", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "ScrId", DbType.AnsiString, "SCR_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "ScrName", DbType.String, "SCR_NAME", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Scsj", DbType.DateTime, "SCSJ", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "AssGrpId", DbType.AnsiString, "ASS_GRP_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "AssGrpName", DbType.String, "ASS_GRP_NAME", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "AssGrpScore", DbType.Int32, "ASS_GRP_SCORE", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "KcrId", DbType.AnsiString, "KCR_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "KcrName", DbType.String, "KCR_NAME", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Kcsj", DbType.DateTime, "KCSJ", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "PdrId", DbType.AnsiString, "PDR_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "PdrName", DbType.String, "PDR_NAME", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Pdsj", DbType.DateTime, "PDSJ", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Zgscqk", DbType.String, "ZGSCQK", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Zgsbqk", DbType.String, "ZGSBQK", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Djkcqk", DbType.String, "DJKCQK", DataRowVersion.Current);
			#endregion
			#region set update cmd pk where parameters
			db.AddInParameter(dbUpdateCommand, "LevDclId", DbType.AnsiString, "LEV_DCL_ID", DataRowVersion.Current);
			#endregion			
			dbDeleteCommand = db.GetSqlStringCommand(SQL_DELETE);
			#region set delete cmd pk where parameters
			db.AddInParameter(dbDeleteCommand, "LevDclId", DbType.AnsiString, "LEV_DCL_ID", DataRowVersion.Current);
			#endregion
		}
		#endregion	
		
		#region Delete模块 Helper		
		
		protected override DbCommand ConstructDeleteCommand(Database db)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_DELETE);
			 
			db.AddInParameter(dbCommand,"LevDclId",DbType.AnsiString);
			 
			return dbCommand;
		}		
		protected override DbCommand ConstructDeleteCommand(Database db,MoLevelDeclare entity)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_DELETE);
			 
			db.AddInParameter(dbCommand,"LevDclId",DbType.AnsiString,entity.LevDclId);
		 
			return dbCommand;
		}
		
		protected override DbCommand ConstructDeleteCommandForWhere(Database db, string where)
        {
            return db.GetSqlStringCommand(SQL_DELETE_DEFAULT + where);            
        }

        protected override DbCommand PopulateDeleteCommandParameters(Database db, DbCommand deleteCmd, MoLevelDeclare entity)
        {
			db.SetParameterValue(deleteCmd,"LevDclId",entity.LevDclId);
			return deleteCmd;
        }

        protected override DbCommand PopulateDeleteCommandParameters(Database db, DbCommand deleteCmd, DataRow row)
        {
			db.SetParameterValue(deleteCmd,"LevDclId",row["LevDclId"]);
			return deleteCmd;
        }      
		
		#endregion helper
		
		#region Query模块 Helper

        protected override DbCommand ConstructQueryCommand(string condition)
        {
            return db.GetSqlStringCommand(SQL_SELECT + condition);
        }

        #endregion
		
		#region GetEntity(s)模块 Helper
        
		protected override DbCommand ConstructSelectOneCommand(Database db,MoLevelDeclare entity)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_SELECT_ONE);
			 
			db.AddInParameter(dbCommand,"LevDclId",DbType.AnsiString,entity.LevDclId);
			return dbCommand;
		}
		
		protected override void PopulateEntityByDataReader(IDataReader reader,ref MoLevelDeclare entity)
		{
			if (!reader.IsDBNull(0)) entity.LevDclId = reader.GetString(0);
			if (!reader.IsDBNull(1)) entity.YearNum = reader.GetInt32(1);
			if (!reader.IsDBNull(2)) entity.ItemType = reader.GetInt32(2);
			if (!reader.IsDBNull(3)) entity.ItemId = reader.GetString(3);
			if (!reader.IsDBNull(4)) entity.ItemName = reader.GetString(4);
			if (!reader.IsDBNull(5)) entity.Class1 = reader.GetString(5);
			if (!reader.IsDBNull(6)) entity.Class2 = reader.GetString(6);
			if (!reader.IsDBNull(7)) entity.Class3 = reader.GetString(7);
			if (!reader.IsDBNull(8)) entity.Class4 = reader.GetString(8);
			if (!reader.IsDBNull(9)) entity.Class5 = reader.GetString(9);
			if (!reader.IsDBNull(10)) entity.Class6 = reader.GetString(10);
			if (!reader.IsDBNull(11)) entity.Class7 = reader.GetString(11);
			if (!reader.IsDBNull(12)) entity.Class8 = reader.GetString(12);
			if (!reader.IsDBNull(13)) entity.Class9 = reader.GetString(13);
			if (!reader.IsDBNull(14)) entity.Class10 = reader.GetString(14);
			if (!reader.IsDBNull(15)) entity.Class11 = reader.GetString(15);
			if (!reader.IsDBNull(16)) entity.Class12 = reader.GetString(16);
			if (!reader.IsDBNull(17)) entity.FromYear = reader.GetInt32(17);
			if (!reader.IsDBNull(18)) entity.FromLevel = reader.GetInt32(18);
			if (!reader.IsDBNull(19)) entity.ToLevel = reader.GetInt32(19);
			if (!reader.IsDBNull(20)) entity.ApproveLev = reader.GetInt32(20);
			if (!reader.IsDBNull(21)) entity.SbdwId = reader.GetString(21);
			if (!reader.IsDBNull(22)) entity.SbdwName = reader.GetString(22);
			if (!reader.IsDBNull(23)) entity.SldwId = reader.GetString(23);
			if (!reader.IsDBNull(24)) entity.SbrId = reader.GetString(24);
			if (!reader.IsDBNull(25)) entity.SbrName = reader.GetString(25);
			if (!reader.IsDBNull(26)) entity.SldwName = reader.GetString(26);
			if (!reader.IsDBNull(27)) entity.Sbsj = reader.GetDateTime(27);
			if (!reader.IsDBNull(28)) entity.LevDclStatus = reader.GetInt32(28);
			if (!reader.IsDBNull(29)) entity.ScrId = reader.GetString(29);
			if (!reader.IsDBNull(30)) entity.ScrName = reader.GetString(30);
			if (!reader.IsDBNull(31)) entity.Scsj = reader.GetDateTime(31);
			if (!reader.IsDBNull(32)) entity.AssGrpId = reader.GetString(32);
			if (!reader.IsDBNull(33)) entity.AssGrpName = reader.GetString(33);
			if (!reader.IsDBNull(34)) entity.AssGrpScore = reader.GetInt32(34);
			if (!reader.IsDBNull(35)) entity.KcrId = reader.GetString(35);
			if (!reader.IsDBNull(36)) entity.KcrName = reader.GetString(36);
			if (!reader.IsDBNull(37)) entity.Kcsj = reader.GetDateTime(37);
			if (!reader.IsDBNull(38)) entity.PdrId = reader.GetString(38);
			if (!reader.IsDBNull(39)) entity.PdrName = reader.GetString(39);
			if (!reader.IsDBNull(40)) entity.Pdsj = reader.GetDateTime(40);
			if (!reader.IsDBNull(41)) entity.Zgscqk = reader.GetString(41);
			if (!reader.IsDBNull(42)) entity.Zgsbqk = reader.GetString(42);
			if (!reader.IsDBNull(43)) entity.Djkcqk = reader.GetString(43);
		}
		
		

        protected override DbCommand ConstructSelectConditionCommand(Database db, string condition)
        {
            return db.GetSqlStringCommand(SQL_SELECT + condition);
        }
		
		#endregion	
		
		#region Count模块 Helper

        protected override DbCommand ConstructCountCommand(Database db)
        {
            return db.GetSqlStringCommand(SQL_COUNT);
        }

        protected override DbCommand ConstructCountConditionCommand(Database db, string condition)
        {
            return db.GetSqlStringCommand(SQL_COUNT + condition);
        }

		#endregion
		
		#region IsExist模块 Helper

        protected override DbCommand ConstructIsExistCommand(Database db, MoLevelDeclare entity)
        {
            DbCommand dbCommand = db.GetSqlStringCommand(SQL_EXIST);
			db.AddInParameter(dbCommand,"LevDclId",DbType.AnsiString,entity.LevDclId);
			return dbCommand;
        }

		#endregion

		
		
	}
}	
#endregion

